﻿using Basic.OAGatewayModule.Interface;
using Basic.OAGatewayModule.Model.FillIn;
using Basic.OARemoteModel.DataFillIn.Model;
using WeDonekRpc.Client;
using WeDonekRpc.Helper.Validate;
using WeDonekRpc.HttpApiGateway;
using WeDonekRpc.HttpApiGateway.Model;

namespace Basic.OAGatewayModule.Api
{
    internal class DataFillInApi : ApiController
    {
        private readonly IDataFillInService _Service;

        public DataFillInApi ( IDataFillInService service )
        {
            this._Service = service;
        }

        public long Add ( FillInAddDto data )
        {
            return this._Service.Add(data, base.UserState.ToEmpId());
        }

        public void Delete ( [NumValidate("oa.fill.id.error", 1)] long id )
        {
            this._Service.Delete(id);
        }

        public FillInDto Get ( [NumValidate("oa.fill.id.error", 1)] long id )
        {
            return this._Service.Get(id);
        }

        public PagingResult<FillInDatum> Query ( PagingParam<FillInQuery> param )
        {
            return this._Service.Query(param);
        }

        public bool Set ( LongParam<FillInSet> data )
        {
            return this._Service.Set(data.Id, data.Value);
        }

        public void Stop ( [NumValidate("oa.fill.id.error", 1)] long id )
        {
            this._Service.Stop(id);
        }
    }
}
